home *** CD-ROM | disk | FTP | other *** search
-
-
-
-
-
-
- //To store all the tools and their child tools
- var navArrayTools = new Array();
-
- //Tool class
- function NavTool(id)
- {
- this.ID = id;
- this.Title = "title";
- //To store the child tools
- this.NavChildren = new Array();
-
- this.AddChild = __NavToolAddChild;
-
- //Add child tool
- function __NavToolAddChild(Obj)
- {
- this.NavChildren[this.NavChildren.length] = Obj;
- }
- }
-
- //Child tool class
- function NavToolChild(id)
- {
- this.ID = id;
- this.Title = "title";
- this.Details = "Details";
- }
-
- //This class handle all rendering for Tools
- function NavToolPanel(ID)
- {
- this.ID = ID;
- this.Render = __NavToolPanelRender;
- this.RenderChildTools = __RenderChildTools;
- this.DrawChildTools = __DrawChildTools
-
- //Render the whole tools section
- function __NavToolPanelRender()
- {
- var content = "";
- if ( window.navArrayTools.length == 0 )
- return "";
-
- content += " <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">";
- content += " <tr>";
- content += " <td width=\"160\" valign=\"top\" bgcolor=\"#c0c0c0\" style=\"border-left:1px solid #c0c0c0\">";
-
-
- content += "<div id=\"divNavTools\" class=\"individual_tools_navi\">";
- content += "<ul>";
- for( var i=0; i<window.navArrayTools.length; i++ )
- {
- var className = (i == 0 ? "active" : "hand");
- content += "<li id=\"li_" + window.navArrayTools[i].ID + "\" onclick=\"SelectNavChild(" + i + ",'" + window.navArrayTools[i].ID+ "')\" class=\"" + className + "\">" + window.navArrayTools[i].Title + "</li>";
- }
- content += "</ul>";
- content += "</div>";
-
- content += " </td>";
- content += " <td rowspan=\"3\" style=\"border-right:1px solid #ccc; border-bottom:1px solid #ccc\">";
-
-
- content += "<div id=\"divChildTools_" + this.ID + "\" class=\"content\">";
- content += this.RenderChildTools(window.navArrayTools[0].NavChildren);
- content += "</div>";
-
- //content += "</div>";//Content
-
- content += "</td></tr><tr>";
- content += " <td height=\"5\" valign=\"bottom\" bgcolor=\"#c0c0c0\"><img src=\"IT_navi_bl.gif\" width=\"5\" height=\"5\" /></td> ";
- content += " </tr>";
- content += " </table>";
-
- content += "<p> </p>";
- return content;
- }
-
- //Render only the child tools, using an array of objects 'NavToolChild'
- function __RenderChildTools(ObjArray)
- {
- if(ObjArray == null)
- return "";
-
- var content = "";
- content += "<table width=\"88%\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" class=\"module_items list\">";
-
- for( var i=0; i<ObjArray.length; i++ )
- {
- var className = (i == 0 ? "toprow" : "");
-
- var a = new ActionButton();
- a.Type = ACTION_BUTTON_CUSTOM;
- a.ID = "a_btn_" + ObjArray[i].ID;
- a.Text = "Start";
- a.Width = "50";
- a.FloatClass = "floatR";
- a.Event = "external.DoOnToolStartButtonClick('" + ObjArray[i].ID + "');";
-
- content += "<tr class=\"" + className + "\">";
- content += " <td><span class=\"module_item_heading\">" + ObjArray[i].Title + "</span>";
- content += ObjArray[i].Details;
- content += " </td>";
- content += " <td class=\"action_buttons_col\">";
- content += a.Render();
-
- //content += " <a href=\"#\"> <img src=\"PT_bt_start.gif\" onclick=\"external.DoOnToolStartButtonClick('" + ObjArray[i].ID + "');\" onmouseover=\"this.src='PT_bt_start_hover.gif'\" onmouseout=\"this.src='PT_bt_start.gif'\" /></a>";
- content += " </td>";
- content += "</tr> ";
- }
- content += "</table>";
- return content;
- }
-
- //Draw only child tools for given index of array navArrayTools
- function __DrawChildTools(index)
- {
- var html = this.RenderChildTools(window.navArrayTools[index].NavChildren);
- Get("divChildTools_" + this.ID).innerHTML = html;
- }
- }
-
- //Load items to global array using the XML file
- function LoadNav(file)
- {
- //empty the array
- navArrayTools = new Array();
-
- var nav = null;
- var xmldoc= null;
- if(window.ActiveXObject)
- {
- xmldoc= new ActiveXObject("MSXML2.DOMDocument.3.0"); //only in ie, load in ie
- xmldoc.load(file);
- }else
- {
- if (document.implementation && document.implementation.createDocument)
- {
- xmldoc= document.implementation.createDocument("","",null);
- xmldoc.load(file); //xml loaded in Mozilla
- alert(file);
- }
- }
-
- var Categories = xmldoc.getElementsByTagName("category");
- var noCategoryTags = Categories.length;
- var objNavTool = null;
-
- // loop thorough categories
- for( var i=0; i< noCategoryTags; i++ )
- {
- var categoryName = Categories[i].getAttribute("name");
- var categoryId = Categories[i].getAttribute("id");
-
- //Create a new Tool
- objNavTool = new NavTool(categoryId);
- objNavTool.Title = categoryName;
-
- var tools = Categories[i].getElementsByTagName("tool");
- var noToolTags = tools.length;
-
- // create child tools
- for( var x=0; x< noToolTags; x++ )
- {
- var id = tools[x].getElementsByTagName("id")[0].firstChild.text;
-
- var childid = tools[x].childNodes[0].firstChild.nodeValue; //ID
- var childTitle = tools[x].childNodes[2].firstChild.nodeValue; //Caption
- var childDetails = tools[x].childNodes[3].firstChild.nodeValue; //Description
-
- //Create a new child tool
- var objNavChildTool = new NavToolChild(childid);
- objNavChildTool.Title = childTitle;
- objNavChildTool.Details = childDetails;
-
- //Add child tool to tool
- objNavTool.AddChild(objNavChildTool);
- }
- //Add tool to the global array
- navArrayTools[navArrayTools.length] = objNavTool;
- }
- }
-
- function SelectNavChild(index, ID)
- {
- var q = new NavToolPanel("nav");
- q.DrawChildTools(index);
-
- //Changing the selected tool css class
- for( var i=0; i<window.navArrayTools.length; i++ )
- {
- var id = "li_" + window.navArrayTools[i].ID;
- SetClass(id, "hand");
- }
- SetClass("li_" + ID, "active");
- }
-
-
- function LoadNavigation(file)
- {
- //Load items to array using the XML
- LoadNav(file);
-
- //Render the tools
- var q = new NavToolPanel("nav");
- Get('divNavToolsBody').innerHTML = q.Render();
-
-
- scaleDivTools();
- }
-
-
- function SetLanguage (Language){
- Get("spLOC_IndividualTools").innerHTML=spLOC_IndividualTools;
-
- };
-
-
- /// test
- function nav2()
- {
- LoadNavigation("NavStandard.xml")
- }
-
-
-
- function nav1()
- {
- LoadNavigation("NavStandard.xml");
- }
-
- function nav2()
- {
- //GrayOut(true);
- //scaleDivTools() ;
- GrayOut(true);
- }
-
- //window.onresize = function() {
-
- // // scaleDivTools() ;
- //};
-
-
-
-
-